﻿<Page
    x:Name="pageRoot"
    x:Class="ComicViewer.GoToPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ComicViewer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">GoTo...</x:String>
        <DataTemplate x:Key="GotoPageTemplate">
            <Button Content="{Binding Path=DisplayName}" Click="bttn_Click" Height="50" Width="75" Tag="{Binding}" Background="{Binding Path=BackColor}"  />
        </DataTemplate>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid x:Name="gotoGrid" Style="{StaticResource LayoutRootStyle}" Background="#E51D1D1D">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5" HorizontalAlignment="Left" Height="95">
                <Button x:Name="backButton" Click="CloseFlyout" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource SettingBkButtonStyle}"/>
                <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource SnappedPageHeaderTextStyle}"/>
            </StackPanel>
            <!--<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Height="95">
                <TextBlock VerticalAlignment="Center" x:Name="txtCurrentPageNo" FontSize="24">10</TextBlock>
                <TextBlock VerticalAlignment="Center" FontSize="24">/</TextBlock>
                <TextBlock VerticalAlignment="Center" x:Name="txtTotalPageNo" FontSize="24">20</TextBlock>
            </StackPanel>-->
            <StackPanel Orientation="Horizontal" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Right" Height="95">
                <Button x:Name="bttnMarkBookmark" ToolTipService.ToolTip="Add Bookmark" VerticalAlignment="Center" HorizontalAlignment="Right"  Click="bttnMarkBookmark_Click" Style="{StaticResource AddBookmarkAppBarButtonStyle}" />
                <Button x:Name="bttnDeleteAllBookmark" ToolTipService.ToolTip="Remove Bookmark" VerticalAlignment="Center" HorizontalAlignment="Right"  Click="bttnDeleteAllBookmark_Click" Style="{StaticResource DeleteBookmarkAppBarButtonStyle}" />
            </StackPanel>
        </Grid>

        <Grid Grid.Row="1" Margin="20,0">
            <GridView x:Name="gotoPanel" ItemTemplate="{StaticResource GotoPageTemplate}" SelectionMode="None" IsItemClickEnabled="True">
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapGrid VerticalChildrenAlignment="Top" HorizontalChildrenAlignment="Center" />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
            </GridView>
            <!--<ScrollViewer x:Name="gotoScroll" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" VerticalScrollMode="Disabled" HorizontalScrollMode="Enabled">
                <StackPanel Orientation="Horizontal" x:Name="gotoStackPanel"></StackPanel>
            </ScrollViewer>-->
        </Grid>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>
                <VisualState x:Name="FullScreenPortrait"/>
                <VisualState x:Name="Snapped"/>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
